home *** CD-ROM | disk | FTP | other *** search
/ Aminet 39 / Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso / Aminet / game / shoot / Orbit_src.lha / Orbit / source / sound_amiga.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-07-04  |  1.1 KB  |  63 lines

  1. /*
  2.     Written by Oliver Gantert
  3.  
  4.     31.04.2000 - Yeah, this works!
  5.     03.05.2000 - Well, it didn't work as good as expected, but
  6.                  it should be better now.
  7.     04.07.2000 - Use lucyplay.library
  8. */
  9.  
  10. #include "orbit.h"
  11.  
  12. LucyPlaySample *smp[3] = { NULL, NULL, NULL };
  13. int ahi_ok = 0;
  14.  
  15. int InitSound()
  16. {
  17.   if (lucAudioInit())
  18.   {
  19.     if (smp[0] = lucAudioLoad("sounds/phaser.wav"))
  20.     {
  21.       if (smp[1] = lucAudioLoad("sounds/explosion1.wav"))
  22.       {
  23.         if (smp[2] = lucAudioLoad("sounds/communicator.wav"))
  24.         {
  25.           ahi_ok = -1;
  26.           return(1);
  27.         }
  28.         lucAudioFree(smp[1]);
  29.       }
  30.       lucAudioFree(smp[0]);
  31.     }
  32.     lucAudioKill();
  33.   }
  34.   return(0);
  35. }
  36.  
  37. int PlayAudio(enum sounds nSound)
  38. {
  39.   if (ahi_ok)
  40.   {
  41.     lucAudioPlay(smp[nSound]);
  42.     return(1);
  43.   }
  44.   return(0);
  45. }
  46.  
  47. void FinishSound()
  48. {
  49.   if (ahi_ok)
  50.   {
  51.     if (smp[0])
  52.     lucAudioFree(smp[0]);
  53.     if (smp[1])
  54.     lucAudioFree(smp[1]);
  55.     if (smp[2])
  56.     lucAudioFree(smp[2]);
  57.     lucAudioKill();
  58.     ahi_ok = 0;
  59.   }
  60.   if (LucyPlayBase)
  61.     CloseLibrary(LucyPlayBase);
  62. }
  63.